﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Fluent="clr-namespace:Fluent">
    <ControlTemplate x:Key="BackstageTabItemControlTemplate" TargetType="{x:Type Fluent:BackstageTabItem}">
    	<Grid x:Name="layoutRoot" Background="#00000000">
    		<Border x:Name="hoverBorder" Margin="0,0,1,0" BorderBrush="{x:Null}" BorderThickness="0" Visibility="Collapsed" Background="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:BackstageTabControl}}}">
    			<Border BorderBrush="#4C000000" BorderThickness="0,1" Background="#BFFFFFFF"/>
    		</Border>
    		<Border x:Name="selectedBorder" Margin="0" Visibility="Collapsed" BorderBrush="#FF000463" BorderThickness="0" Background="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:BackstageTabControl}}}">
    			<Grid HorizontalAlignment="Stretch" Margin="0" Width="Auto">
    				<Border BorderBrush="#7F000000" BorderThickness="0,1">
    					<Border.Background>
    						<RadialGradientBrush RadiusY="1.193" Center="0.5,0.972" GradientOrigin="0.5,0.972" RadiusX="0.662">
    							<RadialGradientBrush.RelativeTransform>
    								<TransformGroup>
    									<ScaleTransform CenterX="0.5" CenterY="0.972" ScaleX="1" ScaleY="1"/>
    									<SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.972"/>
    									<RotateTransform Angle="-0.659" CenterX="0.5" CenterY="0.972"/>
    									<TranslateTransform/>
    								</TransformGroup>
    							</RadialGradientBrush.RelativeTransform>
    							<GradientStop Color="#A5FFFFFF" Offset="0"/>
    							<GradientStop Offset="1"/>
    						</RadialGradientBrush>
    					</Border.Background>
    				</Border>
    				<Path Fill="{DynamicResource BackstageBackgroundBrush}" Stretch="Fill" Stroke="{x:Null}" StrokeThickness="0" HorizontalAlignment="Right" VerticalAlignment="Center" Width="8" Height="15" Data="M1,0L0,1 1,2z" Margin="0,0,-1,0"/>
    			</Grid>
    		</Border>
    		<TextBlock x:Name="controlLabel" HorizontalAlignment="Left" Margin="20,0" VerticalAlignment="Center" Text="{TemplateBinding Header}" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis"/>
    	</Grid>
    	<ControlTemplate.Triggers>
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsMouseOver" Value="True"/>
            <Condition Property="IsEnabled" Value="True"/>
          </MultiTrigger.Conditions>
          <Setter Property="Visibility" TargetName="hoverBorder" Value="Visible"/>
        </MultiTrigger>
        <Trigger Property="IsEnabled" Value="False">
          <Setter Property="Visibility" TargetName="hoverBorder" Value="Hidden"/>
          <Setter Property="Opacity" TargetName="controlLabel" Value="0.5"/>
        </Trigger>
    		<Trigger Property="Selector.IsSelected" Value="True">
    			<Setter Property="Visibility" TargetName="selectedBorder" Value="Visible"/>
          <Setter Property="Foreground" TargetName="controlLabel" Value="White"/>
    		</Trigger>
    	</ControlTemplate.Triggers>
    </ControlTemplate>
  
  
  <Style x:Key="BackstageTabItemStyle" TargetType="{x:Type Fluent:BackstageTabItem}">
      <Setter Property="FontFamily" Value="{DynamicResource DefaultFontFamily}"/>
      <Setter Property="Foreground" Value="{DynamicResource BackstageFontBrush}"/>
      <Setter Property="Template" Value="{StaticResource BackstageTabItemControlTemplate}"/>
      <Setter Property="FocusVisualStyle" Value="{DynamicResource ControlStyleEmptyFocus}"/>
      <Setter Property="Height" Value="37"/>
        <Setter Property="Background" Value="{Binding Background, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Fluent:BackstageTabControl}}}"/>
        <Setter Property="Margin" Value="0,1"/>
  </Style>
</ResourceDictionary>